Repository navigation
feat(database): layerTest, a Database with no server for unit tests - #93
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 52 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
…nd afterCommit SqlClient.make now requires a driver name. Tests the fake on sqliteDialect (? placeholders, integer booleans, BEGIN/COMMIT), d1Dialect (no transactions) and Db.afterCommit (runs after COMMIT, never after ROLLBACK). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Merge-readiness pass (71e82cf):
Verified locally:
CI run 41472238736 started without needing approval. If it fails only on the known fuzz flakes, they are fixed separately in #131: ClickHouse/Postgres division by zero in |
Maple review🟡 Confidence 6/10 · needs attention. Held at 6 because a correctness warning is open. Adds
Findings🟠 Warning · F1 ·
|
| replies.slice(1), | ||
| ]), | ||
| (next) => { | ||
| const reply = next ?? respond(statement) |
There was a problem hiding this comment.
Warning
SET TRANSACTION takes the reply queued for the transaction body's query
F1 · Warning · correctness
With postgresDialect, Db.transaction(body, { isolationLevel }) first runs SET TRANSACTION through Database.execute (src/database/database.ts:392), which is the prepared path, so it pops the next queued reply. The body's query then gets respond or no rows, and the test sees [] instead of what it queued.
Skip the queue in `answer` for the transaction-settings statement (SQL starting with `SET TRANSACTION`), the way `control` already does for BEGIN and COMMIT.
🤖 Prompt to fix with an AI agent
In `src/database/test-layer.ts:87-88`: `SET TRANSACTION` takes the reply queued for the transaction body's query.
With `postgresDialect`, `Db.transaction(body, { isolationLevel })` first runs `SET TRANSACTION` through `Database.execute` (`src/database/database.ts:392`), which is the prepared path, so it pops the next queued reply. The body's query then gets `respond` or no rows, and the test sees `[]` instead of what it queued.
Suggested fix: Skip the queue in `answer` for the transaction-settings statement (SQL starting with `SET TRANSACTION`), the way `control` already does for BEGIN and COMMIT.
Verify the problem exists at that location before changing it, and keep the fix to those lines.
No description provided.